package com.morse.mycomputer

import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.junit.Test

import org.junit.Assert.*

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @OptIn(DelicateCoroutinesApi::class)
    @Test
    fun addition_isCorrect() {
        val job = GlobalScope.launch {
            println("job start")
            delay(100)
            withContext(coroutineContext) {
                println("with context start")
                delay(100)
                println("with context end")
            }

            launch {
                println("sub launch start")
                delay(100)
                println("sub launch end")
            }
            println("job end")
        }
        job.start()
    }
}